import logging,yamail,time,pytest
def log(s):
    logging.basicConfig(filename=s,filemode='w+',format='%(filename)s %(lineno)d %(thread)d ',level=logging.ERROR)
def yj(f):
    tim=yamail.SMTP(user='1391277593@qq.com',password='npphtjsegwjqhiae',host='smtp.qq.com')
    tim.send(to='1391277593@qq.com',subject='163邮箱系统Web Ui自动化测试报告',contents='请查收测试报告',attachments=f)
if __name__ == '__main__':
    s = time.strftime('%Y%m%d%H%M%S')
    a=s+'.text'
    c=s+'.html'
    log(a)
    pytest.main(['Testcase.py','',f'--html={c}'])
    yj([a,'mm.html'])